Skip to content

[CONFIGURATION] Apply general attribute_limits to tracer and logger providers - #4468

Open
ayush-singh-0601 wants to merge 9 commits into
open-telemetry:mainfrom
ayush-singh-0601:config-general-attribute-limits
Open

[CONFIGURATION] Apply general attribute_limits to tracer and logger providers#4468
ayush-singh-0601 wants to merge 9 commits into
open-telemetry:mainfrom
ayush-singh-0601:config-general-attribute-limits

Conversation

@ayush-singh-0601

@ayush-singh-0601 ayush-singh-0601 commented Aug 21, 2026

Copy link
Copy Markdown

Fixes #4467

The YAML parser already accepted attribute_limits, but SdkBuilder logged a warning and ignored them. Per the spec, general attribute limits should apply when tracer/logger limits are not set, and model-specific limits should win when they are.

Changes

  • Pass attribute_limits from CreateConfiguredSdk into CreateTracerProvider and CreateLoggerProvider.
  • If a provider has no limits, copy attribute_count_limit and attribute_value_length_limit from the general config into SpanLimits / LogRecordLimits.
  • If a provider does have limits, keep using those values (including span-only fields such as event/link limits).
  • CreateTracerProvider and CreateLoggerProvider take an optional AttributeLimitsConfiguration* that defaults to nullptr.
  • Unit tests cover general limits, provider override, and CreateConfiguredSdk wiring for both traces and logs.

How changes were tested

  • Added SdkBuilder.SpanLimitsFromAttributeLimits and SdkBuilder.SpanLimitsOverrideAttributeLimits.
  • Added programmatic tests that emit log records through a recording exporter and that read GetSpanLimits() on the configured tracer provider.

I could not run the C++ test binaries in this environment (no local CMake/Bazel build of opentelemetry-cpp). CI should run sdk_builder_test and programmatic_configuration_test.

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

…roviders

The YAML parser already accepted attribute_limits, but SdkBuilder
ignored them. Pass the general limits into CreateTracerProvider and
CreateLoggerProvider, and use them when the provider has no
model-specific limits. Provider limits still take precedence.

Fixes open-telemetry#4467
@ayush-singh-0601
ayush-singh-0601 requested a review from a team as a code owner August 21, 2026 15:30
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.01961% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.15%. Comparing base (cd252b4) to head (9643298).

Files with missing lines Patch % Lines
sdk/src/configuration/sdk_builder.cc 98.37% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4468      +/-   ##
==========================================
+ Coverage   83.09%   83.15%   +0.06%     
==========================================
  Files         519      520       +1     
  Lines       20253    20317      +64     
==========================================
+ Hits        16827    16892      +65     
+ Misses       3426     3425       -1     
Files with missing lines Coverage Δ
...de/opentelemetry/sdk/configuration/document_node.h 100.00% <ø> (ø)
...e/opentelemetry/sdk/configuration/optional_value.h 100.00% <100.00%> (ø)
...entelemetry/sdk/configuration/ryml_document_node.h 100.00% <ø> (ø)
...lude/opentelemetry/sdk/configuration/sdk_builder.h 100.00% <ø> (ø)
sdk/src/configuration/configuration_parser.cc 84.80% <100.00%> (-0.06%) ⬇️
sdk/src/configuration/ryml_document_node.cc 83.83% <100.00%> (+0.24%) ⬆️
sdk/src/configuration/sdk_builder.cc 62.81% <98.37%> (+1.60%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ayush-singh-0601

Copy link
Copy Markdown
Author

can you please any changes that i need to make or is it fine

@ayush-singh-0601

Copy link
Copy Markdown
Author

all checks are passed , please tell if any more changes needed

@dbarker dbarker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! Requesting a minor change noted below.

Comment thread sdk/include/opentelemetry/sdk/configuration/sdk_builder.h
@ayush-singh-0601

Copy link
Copy Markdown
Author

@dbarker done

@dbarker dbarker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates. Diving deeper into the spec and use cases I'm requested a change to the limit models and application methods to meet the spec.

Comment thread sdk/src/configuration/sdk_builder.cc Outdated
Make each limit on AttributeLimits, SpanLimits, and LogRecordLimits
optional so omitted keys and YAML null are unset. Merge uses the
model-specific value if set, else the general attribute_limits value,
else the model-specific default.
@ayush-singh-0601

Copy link
Copy Markdown
Author

@dbarker updated. Limit fields are optional now so omitted/null is distinct from a set value. Merge is model-specific if set, else general attribute_limits, else the model default.

@ayush-singh-0601

Copy link
Copy Markdown
Author

Thanks for syncing main into the branch. I checked the latest run, and all eight GitHub Actions workflows are currently marked action_required, so they have not actually executed yet. Could you approve them when convenient? The previous run did show IWYU, formatting, and several C++14/CMake failures, so once the fresh run is available I will address any remaining PR-specific issues together. Thanks!

@ayush-singh-0601

Copy link
Copy Markdown
Author

I pushed c995d4e with the CI fixes: applied clang-format 18, added the direct optional_value.h includes requested by IWYU, and removed the C++14 ODR-use that caused the sdk_builder_test linker failures. The local format check, diff check, and C++14 smoke compile pass. All eight replacement workflows are showing action_required again, so could you approve this run when convenient? Thanks!

Comment thread sdk/src/configuration/ryml_document_node.cc Outdated
Comment thread sdk/include/opentelemetry/sdk/configuration/optional_value.h Outdated
@ayush-singh-0601

Copy link
Copy Markdown
Author

Both latest review comments are addressed in 9643298, with focused regression tests. The eight replacement workflows are currently marked action_required; could you approve this run when convenient? Thanks!

@ayush-singh-0601

Copy link
Copy Markdown
Author

All checks passed if any more changes required , please let me know

@dbarker dbarker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feature! I've approved, but would like @marcalff to also review before merging since this touches the yaml parser and models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CONFIGURATION] General attribute limits

2 participants